<!DOCTYPE HTML>
<html lang="zh-cn">

	<head>
		<!--<base href="http://test.youxiduo.com/iweb/2017_teacher_daily/" />-->
		<base href="http://resource.youxiduo.com/special/shihou/promoter/3389V1.1/" />
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="format-detection" content="telephone=no">
		<meta name="viewport" content="width=device-width,user-scalable=no">
		<title>2017狮吼学院教师节</title>
		<meta name="keywords" content="狮吼,狮吼直播,手游直播,双投屏直播" />
		<meta name="description" content="狮吼 - 4亿手游玩家的直播平台、狮吼是游戏多旗下手游直播平台，支持双投屏直播的移动端平台，边玩边播，分享快乐！狮吼直播，随时随地录屏直播，语音弹幕独特玩法，各路主播游戏大神齐聚；电竞赛事、综艺娱乐、户外精彩，一切改变尽在 狮吼- 4亿手游玩家的直播平台。" />
		<link rel="stylesheet" href="static/css/base.css" />
		<link rel="stylesheet" href="static/css/style.css" />

	</head>

	<body>

		<div class="wrap commonWrap">

			<!-- 评论 -->
			<div class="common">
				<div class="commonTab" style=" background:url(static/img/bg1.png) no-repeat; background-size:100%;">
					<div class="commonMenu commonLiat">
						<ul>
							<li><img src="static/img/commomTabCurr1.png" /></li>
							<li><img src="static/img/commomTab2.png" /</li>
						</ul>
					</div>
					<div class="line">
						<div class="bg">
							<div class="nav">
								<input placeholder="快来留言吧~" id="content" />
								<a class="spend"><img src="static/img/spend.png" /></a>
							</div>
							<ul class="list">
							</ul>
							<a class="more"><img src="static/img/more.png" /></a>
							<div class="space"></div>
						</div>
					</div>
					<img class="Listfooder" src="static/img/bg3.png" />
				</div>
			</div>
        </div>
			<div class="pop">请登录后再来参加活动吧~</div>

			<script src="static/js/jquery-3.1.0.min.js"></script>
			<script type="text/javascript" src="static/js/forum.js"></script>
			<script language="JavaScript">
				var from_user_id;
				var activity_id;
				var forum;
				$(function() {
					forum = new Forum();
					from_user_id = forum.getUrlParam('from_user_id');
					activity_id = forum.getUrlParam('share_conf_id');
					//common
					var currIndex = 0;
					$(".commonMenu li").on("click", function() {
						currIndex = $(this).index();
						forum.orderType = currIndex + 1;
						$(".commonMenu li").each(function() {
							$(this).find("img").attr({
								"src": "static/img/commomTab" + ($(this).index() + 1) + ".png"
							});
						});
						$(this).find("img").attr({
							"src": "static/img/commomTabCurr" + (currIndex + 1) + ".png"
						});
						forum.uid = from_user_id;
						forum.activity_id = activity_id;
						forum.pageNum = 1;
						forum.pageSize = 5;
						onloadFormuList();
					});
					$(".commonMenu li").eq(0).click();

					$(".nav").on("click", function() {
						if(forum.getUrlParam('from_user_id') == "0"){
							window.location.href = "shihoutv://route?jump_type=120";
							return;
						}
						$(".commonIn").fadeIn();
						$(".commonWrap").css({
							"padding-bottom": "45px"
						});
					});

					//发送留言
					$('.spend').on('click', function() {
						if(forum.getUrlParam('from_user_id') == "0") {
							window.location.href = "shihoutv://route?jump_type=120";
							return;
						}
						forum.content = $('#content').val();
						forum.pulibshComment(forum.publish_forum, forum.check_gift);
						onloadFormuList();
					});

					//点击查看更多
					$('.more').on('click', function() {
						forum.pageNum = forum.pageNum + 1;
						onloadFormuList();
					});

					//用户是否送过礼物
					forum.uid = from_user_id;
					forum.checkSendGift(forum.check_gift);

				})

				//点赞
				function fabulous(obj) {
					if(from_user_id == "0") {
						window.location.href = "shihoutv://route?jump_type=120";
						return;
					}
					forum.id = $(obj).attr('data-id');
					forum.uid = from_user_id;
					forum.toUid = $(obj).attr('data-uid');
					forum.fabulous(forum.forum_fabulous, obj);
				}

				function onloadFormuList() {
					forum.getFormListCallback(forum.forum_list_url, function(res) {
						if(res.errorCode == "0") {
							var list = res.result.list;
							var html = '';
							var item_user_ids = '';
							for(var i = 0; i < list.length; i++) {
								var zanImg = 'zan';
								var item = list[i];
								var curr_uid = forum.parseResult(item, 'uid');
								var create_time = forum.parseResult(item, 'create_time');
								var create_time1 = create_time.split(' ')[0];
								var create_time1_array = create_time1.split('-');
								create_time1 = create_time1_array[1] + '-' + create_time1_array[2];
								var create_time2 = create_time.split(' ')[1];
								var create_time2_array = create_time2.split(':');
								create_time2 = create_time2_array[0] + ':' + create_time2_array[1];
								create_time = create_time1 + ' ' + create_time2;
								if(forum.parseResult(item, 'fabulousStatus'))
									zanImg = 'yizan';
								html += '<li data-id="' + forum.parseResult(item, 'id') + '" data-uid="' + curr_uid + '">' +
									'    <p class="listTitle"><span>' + forum.parseResult(item, 'content') + '</span><a data-id="' + forum.parseResult(item, 'id') + '" data-uid="' + curr_uid + '" onclick="fabulous(this);"><img src="static/img/' + zanImg + '.png"/></a></p>' +
									'    <p class="listFont">' +
									'        <a id="img-' + curr_uid + '" data-create-time="' + create_time + '">' + create_time + '</a>' +
									'        <span>赞：<em>' + forum.parseResult(item, 'fabulous_count') + '</em></span>' +
									'    </p>' +
									'</li>';
								item_user_ids += '&user_ids[]=' + curr_uid;
							}
							if(forum.pageNum == 1)
								$('.list').html(html);
							else
								$('.list').append(html);

							console.log(list.length)
							if(list.length < forum.pageSize){
								$('.more').hide();
							}else{
								$('.more').show();
							}
							
							//根据用户id取到用户信息并赋值到页面
							forum.requestRemoteDataJson(forum.user_batch+item_user_ids, {}, function(userResult){
								if(userResult.error == 0){
									var users = forum.parseResult(userResult, 'data', 'users');
									for(var i = 0;i < users.length;i++){
										var user = users[i];
										var user_id = forum.parseResult(user, 'id');
										var nick_name = forum.parseResult(user, 'nick_name');
										var avatar = forum.parseResult(user, 'avatar');
										var createTimeHtml = $('#img-'+user_id).attr('data-create-time'); 
										$('#img-'+user_id).html('<em><img src="'+avatar+'"/></em><i>'+nick_name+'</i>'+createTimeHtml);
									}
								}
							});
							
						}

					});
				}
			</script>

	</body>

</html>